package com.example.res.service.impl;

import com.example.res.annotation.DistributionLock;
import com.example.res.service.IOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class OrderServiceImpl implements IOrderService {


    @Override
    @DistributionLock(key = "updateOrderSatus", tryLockTime = 1000)
    public String updateOrder() {
        try {
            log.info("updateOrder 处理业务 start" + Thread.currentThread());
            Thread.sleep(1000 * 10);
            log.info("updateOrder 处理业务 end" + Thread.currentThread());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "修改订单状态成功";
    }

}
